package com.chc.web.dash_board.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.chc.utils.Msg;
import com.chc.web.dash_board.entity.dto.DashBoardDTO;
import com.chc.web.dash_board.entity.vo.DashboardVo;
import com.chc.web.dash_board.service.DashBoardService;
import com.chc.web.fee_park.entity.FeePark;
import com.chc.web.fee_park.entity.FeeParkParm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.Date;

/**
 * @Author: chc
 * @Date: 2024/11/10/21:32
 * @Description:
 */
@RestController
@RequestMapping("/api/dashboard")
public class DashBoardController {

    @Autowired
    private DashBoardService dashBoardService;

    /**
     * 获取首页可视化数据展示
     * */
    @GetMapping("/getInfo")
    public Msg getInfoList(DashBoardDTO dashBoardDTO) {
        // 格式化日期
        String format = new SimpleDateFormat("yyyy-MM-dd").format(new Date(Long.valueOf(dashBoardDTO.getDate())));
        System.out.printf(format);
        DashboardVo dataCount = dashBoardService.getInfoCount(format);
        return Msg.success("查询成功",dataCount);
    }
}
